package com.bluesky.light.order;

import java.util.Date;
import java.util.List;

import com.bluesky.light.user.User;

/**
 * @author Lemon
 *
 */
/**
 * @author Lemon
 *
 */
public class OrderService {

	/**
	 * 
	 */
	private static OrderService mgr = null;
	
	/**
	 * 
	 */
	private static OrderDAO dao = new OrderDAO();
	
	/**
	 * 
	 */
	private OrderService() {}
	
	/**
	 * @return
	 */
	public static OrderService getInstance() {
		if (mgr == null) {
			mgr = new OrderService();
		}
		return mgr;
	}
	
	/**
	 * @param to
	 * @return
	 */
	public int add(TreatOrder to) {
		return dao.add(to);
	}
	
	/**
	 * @return
	 */
	public List<TreatOrder> getOrders() {
		return dao.getOrders();
	}

	/**
	 * @param u
	 * @param opdate
	 */
	public void createTreatment(User u, Date opdate) {
		dao.createTreatment(u, opdate);		
	}
	
	/**
	 * @param opdate
	 * @return
	 */
	public int getBookCount(Date opdate) {
		return dao.getBookCount(opdate);
	}

	/**
	 * @param date
	 * @return
	 */
	public List<Integer> getUsersId(Date date) {
		return dao.getUsersId(date);
	}

	/**
	 * @param to
	 * @return
	 */
	public int update(TreatOrder to) {
		return dao.update(to);
	}
	
	/**
	 * @param date
	 * @param status
	 * @return
	 */
	public List<TreatOrder> getOrders(Date date, String status) {
		return dao.getOrders(date, status);
	}

	/**
	 * @param userno
	 * @return
	 */
	public User getUser(int userno) {
		return dao.getUser(userno);
	}
	
	/**
	 * @param u
	 * @param status
	 * @return
	 */
	public TreatOrder getOrder(User u, String status) {
		return dao.getOrder(u, status);
	}

	/**
	 * @param treatOrder
	 * @return
	 */
	public List<TreatItem> getItems(TreatOrder treatOrder) {
		return dao.getItems(treatOrder);
	}
	
	/**
	 * @param treatOrderId
	 * @param status
	 */
	public void update(int treatOrderId, String status) {
		dao.update(treatOrderId, status);
	}

	/**
	 * @param date
	 * @return
	 */
	public List<Double> getFinanicalDates(Date date) {
		return dao.getFinanicalDates(date);
	}

}
